#ifndef _RES_MANAGER_H_
#define _RES_MANAGER_H_

#include"utility/hashmap.h"
#include <string>
namespace KEngine
{
	template <typename T>
	class ResManager
	{
	public:
		typedef hash_map<std::string,T*> ResMap;
		

		virtual T* create(std::string& name) = 0;
		T* getT(std::string& name)
		{
			ResMap::iterator it = _resMap.find(name);
			if(it==_resMap.end())
				return 0;

			return it->second;
		}

		void release(T* p)
		{
			if(p)
				releaseByName(std::string(p->getName()));
		}

		virtual void releaseByName(std::string& name) = 0;
		
	protected:
		ResMap	_resMap;
	};


};

#endif